package models

import (
	"gorm.io/gorm"
	"time"
)

type Model struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type UserBasic struct {
	Model
	Name         string
	PassWord     string
	Avatar       string
	Gender       string `gorm:"column:gender;default:male;type:varchar(6) comment 'male表示男，female表示女 '"`
	Phone        string `valid:"matches(^1[3,9]{1}\\d{9}$)"`
	Email        string `valid:"email"`
	Identity     string
	ClientIp     string
	ClientPort   string
	Salt         string
	LoginTime    *time.Time `gorm:"column:login_time;type:datetime"`
	HeartBeat    *time.Time `gorm:"column:heart_beat;type:datetime"`
	LoginOutTime *time.Time `gorm:"column:login_out_time;type:datetime"`
	IsLoginOut   bool
	DeviceInfo   string
}

func (table *UserBasic) TableName() string {
	return "user_basic"
}
